﻿@using Pyramid.Models
@using Pyramid.Mvc.Html
@model IEnumerable<ConsumeRecord>

@{
	var bag = (PagerModel) ViewBag.Bag;
	var qm = (ConsumeRecordQueryModel) ViewBag.QueryModel;
}

@using (Html.BeginForm("ConsumeRecords", "Consume", FormMethod.Post, new {id = "pagerForm"}))
{
	<input type="hidden" name="pageNum" value="1" />
	<input type="hidden" name="numPerPage" value="${model.numPerPage}" />
}
<div class="pageHeader">
	@using (Html.BeginForm("ConsumeRecords", "Consume", FormMethod.Post, new { onsubmit = "return navTabSearch(this);" }))
	{
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>查询关键词：<input type="text" name="keywords" rel="pagerForm" value="@qm.Keywords" /></td>
				</tr>
			</table>
		</div>
		<div class="subBar">
			<table>
				<tr>
					<td>建档日期从  
						<input type="text" name="dateFrom" class="date" readonly="readonly" rel="pagerForm" value="@Html.DateString(qm.DateFrom)" />
						至 
						<input type="text" name="dateTo" class="date" readonly="readonly" rel="pagerForm"  value="@Html.DateString(qm.DateTo)"/>
					</td>
					<td>&nbsp;&nbsp;</td>
					<td>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">查询</button>
							</div>
						</div>
					</td>
				</tr>
			</table>
		</div>
	}
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="@Url.Action("CreateRecord")" target="navTab" rel="tab_ccm_consumerecord_edit"><span>添加顾客消费记录</span></a></li>
			<li><a class="edit" href="@Url.Action("EditRecord", new {id = "{id}"})"  target="navTab" rel="tab_ccm_consumerecord_edit"><span>修改顾客消费记录</span></a></li>
			<li><a class="delete" href="@Url.Action("DeleteRecord", new {id = "{id}"})" target="ajaxTodo" title="确定要删除吗？"><span>删除</span></a></li>
		</ul>
	</div>
	<table class="table" width="100%" layouth="138">
		<thead>
			<tr>
				<th>@Html.DisplayNameFor(m => m.Customer.Code)</th>
				<th>@Html.DisplayNameFor(m => m.Customer.FullName)</th>
				<th>@Html.DisplayNameFor(m => m.Customer.Gender)</th>
				<th>@Html.DisplayNameFor(m => m.ConsumeItem.ItemName)</th>
				<th>@Html.DisplayNameFor(m => m.ConsumeItem.MarketPrice)</th>
				<th>@Html.DisplayNameFor(m => m.ConsumeItem.VipPrice)</th>
				<th>@Html.DisplayNameFor(m => m.ActualPrice)</th>
				<th>@Html.DisplayNameFor(m => m.EditUserId)</th>
				<th>@Html.DisplayNameFor(m => m.EditTime)</th>
			</tr>
		</thead>
		<tbody>
			@foreach (var s in Model)
			{
				<tr target="id" rel="@s.Id">
					<td>@s.Customer.Code</td>
					<td>@s.Customer.FullName</td>
					<td>@s.Customer.GenderString</td>
					<td>@s.ConsumeItem.ItemName</td>
					<td>@s.ConsumeItem.MarketPrice.ToString("C")</td>
					<td>@s.ConsumeItem.VipPrice.ToString("C")</td>
					<td>@s.ActualPrice.ToString("C")</td>
					<td>@s.EditUserId</td>
					<td>@s.EditTime.ToString("yyyy-MM-dd")</td>
				</tr>
			}
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange=" navTabPageBreak({ numPerPage: this.value }) ">
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			<span>条，共 @bag.TotalCount 条</span>
		</div>
		<div class="pagination" targettype="navTab" totalcount="@bag.TotalCount" numperpage="@bag.PageSize" pagenumshown="10" currentpage="@bag.CurrentPageIndex"></div>
	</div>
</div>
